public class text5 {
    public static void main(String[] args) {
        //加密
        int n = 1234;
        int temp = n;
        int amount = 0;
        while (n != 0) {
            n = n / 10;
            amount++;
        }
        int[] arr = new int[amount];
        for (int i = amount - 1; i >= 0; i--) {
            int ge = temp % 10;
            arr[i] = ge;
            temp = temp / 10;
        }
        for (int i = 0; i < arr.length; i++) {
            arr[i] = arr[i] + 5;
        }
        for (int i = 0; i < arr.length; i++) {
            arr[i] = arr[i] % 10;
        }
        for (int i = 0, j = arr.length - 1; i < j; i++, j--) {
            int tem = arr[i];
            arr[i] = arr[j];
            arr[j] = tem;
        }
        int number1 = 0;
        for (int i = 0; i < arr.length; i++) {
            number1 = number1 * 10 + arr[i];//第一个数字不能为零
        }
        System.out.println(number1);
        //解密
        for (int i = 0, j = arr.length - 1; i < j; i++, j--) {
            int tem = arr[i];
            arr[i] = arr[j];
            arr[j] = tem;
        }
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] >= 5 && arr[i] <= 9) {
                arr[i] = arr[i] - 5;
            } else {
                arr[i] = arr[i] + 10 - 5;
            }
        }
        int number2 = 0;
        for (int i = 0; i < arr.length; i++) {
            number2 = number2 * 10 + arr[i];//第一个数字不能为零
        }
        System.out.println(number2);
    }
}
